﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// adds this reference 
using Bluyel.Core;


namespace Bluyel_Samples_VS10
{
    /// <summary>
    /// Some basics samples codes watching how to use the BluyelTypes library.
    /// </summary>
    class Program
    {
        //---------------------------------------------------------------------
        static void DoSample_Types()
        {
            Console.WriteLine("\n==========SampleTypes:");
            Sample_Types sampleTypes = new Sample_Types();
            sampleTypes.DefineAllTypesFindCheck();
            sampleTypes.DefineAllTypesWithSingleLine();
        }

        //---------------------------------------------------------------------
        static void DoSample_DVal_Basic()
        {
            Console.WriteLine("\n==========Sample_DVal_Basic:");
            Sample_DVal_Basic s = new Sample_DVal_Basic();
            s.CreateStringValueHello();
            s.CreateIntValue12();
        }

        //---------------------------------------------------------------------
        static void DoSample_VarConst_Basic()
        {
            Console.WriteLine("\n==========Sample_VarConst_Basic:");
            Sample_VarConst_Basic s = new Sample_VarConst_Basic();
            s.Create2Vars();
            s.CreateVarChangeSetVal();
            s.CreateConstTryChangeVal();
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Sample Var Const: Struct with members basic types.
        /// </summary>
        static void DoSample_VarConst_Struct_M_Basic()
        {
            Console.WriteLine("\n==========Sample_VarConst_Data Structure with members Basics types:");
            Sample_VarConst_Struct_M_Basic s = new Sample_VarConst_Struct_M_Basic();
            s.CreateStruct_M_Int_String_Bool();
            s.CreateStruct_M_FindMemberInt();
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Sample Type and var/const LOV String.
        /// </summary>
        static void DoSample_LOVString()
        {
            Console.WriteLine("\n==========Sample Type and var/const of LOV String:");
            Sample_LOVString s = new Sample_LOVString();
            s.CreateTypeLOVStringRemoveOne();
            WaitKey();

            s.CreateTypeLOVString_AddRemoveItems();
            WaitKey();

            s.CreateTypeLOVString_AddItems_FindIt();
            WaitKey();

            s.CreateTypeLOVString_CreateVar();
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Sample Type and var/const LOV String.
        /// </summary>
        static void DoSample_DVal_PhyLength()
        {
            Console.WriteLine("\n==========Sample physical qty length values: create, compare, convert:");
            Sample_DVal_PhyLength s = new Sample_DVal_PhyLength();
            s.CreateDValPhyLength();
            WaitKey();

            s.CreateDValPhyLength_ConvertfromPrefixToAnother();
            WaitKey();

            s.CreateDValPhyLength_Compare();
            WaitKey();

            s.CreateDValPhyLength_YardAndConvert();
        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Sample Var/Const Physical qty length.
        /// </summary>
        static void DoSample_VarConst_PhyLength()
        {
            Console.WriteLine("\n==========Sample Var/Const Physical qty length:");
            Sample_VarConst_PhyLength s = new Sample_VarConst_PhyLength();
            s.CreateVars();
            WaitKey();

            s.Compare2Vars();
            WaitKey();

            s.ConvertValue();
            WaitKey();

            s.CreateConstTryChangeVal();

        }

        //---------------------------------------------------------------------
        /// <summary>
        /// Sample Var/Const Data Structure with members Phy Length types.
        /// </summary>
        static void DoSample_VarConst_Struct_M_PhyLength()
        {
            Console.WriteLine("\n==========Sample Var/Const Data Structure with members Phy Length types:");
            Sample_VarConst_Struct_M_PhyLength s = new Sample_VarConst_Struct_M_PhyLength();
            s.CreateStruct_M_String_PhyLength();
        }

        //---------------------------------------------------------------------
        static void WaitKey()
        {
            Console.WriteLine("\nWait, Hit a key...");
            Console.ReadKey();        
        }         

        //---------------------------------------------------------------------
        static void Main(string[] args)
        {
            bool continueLoop=true;
            do{
                Console.WriteLine(" ");
                Console.WriteLine("************************************************");
                Console.WriteLine("Bluyel Types Library: code samples.");
                Console.WriteLine("1. types.");
                Console.WriteLine("2. Data Values basic type.");
                Console.WriteLine("3. Var/Const basic type.");
                Console.WriteLine("4. Var/Const Data Structure with members basic type.");
                Console.WriteLine("5. Type and var/const LOV String.");
                Console.WriteLine("6. Physical qty length: create values, compare, convert.");
                Console.WriteLine("7. Var/Const Physical qty length.");
                Console.WriteLine("8. Var/Const Data Structure with members Phy Length types.");


                Console.WriteLine("x. Exit.");

                ConsoleKeyInfo k= Console.ReadKey();

                // defines types, find by name, by id and check
                if(k.KeyChar =='1')
                    DoSample_Types();

                if (k.KeyChar == '2')
                    // create some data value: int and string
                    DoSample_DVal_Basic();

                if (k.KeyChar == '3')
                    // create var and const of basic type
                    DoSample_VarConst_Basic();

                if (k.KeyChar == '4')
                    // Sample Var Const: Struct with members basic types
                    DoSample_VarConst_Struct_M_Basic();

                if (k.KeyChar == '5')
                    // Type and var/const LOV String
                    DoSample_LOVString();

                if (k.KeyChar == '6')
                    // DVal PhyLength, compare, convert
                    DoSample_DVal_PhyLength();


                if (k.KeyChar == '7')
                    // Var/Const Physical qty length
                    DoSample_VarConst_PhyLength();

                if (k.KeyChar == '8')
                    // Var/Const Data Structure with members Phy Length types
                    DoSample_VarConst_Struct_M_PhyLength();

                // x/X to exit the application samples
                if (k.KeyChar == 'x' || k.KeyChar == 'X')
                {
                    Console.WriteLine("\nBye!, Hit a key...");
                    Console.ReadKey();
                    break;
                }

                WaitKey();
            } while (continueLoop);





            // Sample_DVal_PhyLength  : Convertions, comparisons

            // Sample_Var Const: Phy Length
            // Sample_VarConst_PhyLength

            // Sample_VarConst_Struct_M_PhyLength

            // + tard:
            // Sample_ListType

            // Sample_ListData

        }
    }
}
